<%--
  Created by IntelliJ IDEA.
  User: LWLONG
  Date: 2021/2/26
  Time: 16:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title>购物车列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- 在web项目中 css的路径要替换为 css文件的uri
    也就是 /项目名/css/style.css
    -->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
</head>
<body>
<div id="wrap">
    <div id="top_content">
        <div id="header">
            <div id="rightheader">

            </div>
            <div id="topheader">
                <h1 id="title">
                    <a href="${pageContext.request.contextPath}/cart/cartList.jsp">购物车管理</a>
                </h1>
            </div>
            <div id="navigation">
            </div>
        </div>
        <div id="content">
            <p id="whereami">
            </p>
            <h1>
                欢迎,${username}!
            </h1>
            <h4 style="color: #CE090E">${msg}</h4>
            <c:remove var="msg" scope="session"></c:remove>
                <div align="right"><a class="btn" href="${pageContext.request.contextPath}/product/queryList?${queryString}">商品管理</a></div>
            <table class="table">
                <tr class="table_header">
                    <td>
                        序号
                    </td>
                    <td>
                        商品名
                    </td>
                    <td>
                        单价
                    </td>

                    <td>数量</td>
                    <td>总价</td>
                    <td>
                        操作
                    </td>
                </tr>
                <c:set var="index" value="0" />
                <c:forEach var="entry" items="${cart}">
                <tr class="row1">
                    <td>
                        <c:set var="index" value="${index+1}" /> ${index}
                    </td>
                    <td>
                        ${entry.value.name}
                    </td>
                    <td>
                        ￥${entry.value.price}
                    </td>
                    <td>${entry.value.account}</td>
                    <td>￥${entry.value.price*entry.value.account}</td>
                    <td>
                        <a href="${pageContext.request.contextPath}/cart/delete/${entry.value.id}"><input type="button" value="删除"/></a>&nbsp;<a href="${pageContext.request.contextPath}/cart/UpdateCount/increase/${entry.value.id}"><input type="button" value="+"/></a>&nbsp;<a href="${pageContext.request.contextPath}/cart/UpdateCount/reduce/${entry.value.id}"><input type="button" value="-"/></a>
                    </td>
                </tr>

                </c:forEach>
            </table>

        </div>

    </div>
    <div id="footer">
        <div id="footer_bg">
            www.zparkhr.com.cn
        </div>
    </div>
</div>
</body>
</html>
